package com.ssm.service.impl;

import com.ssm.dao.SelectcourseMapper;
import com.ssm.entity.Selectcourse;
import com.ssm.entity.SelectcourseExample;
import com.ssm.service.SelectCourseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("selectCourseService")
public class SelectCourseServiceImpl  implements SelectCourseService{

    @Resource(name = "selectcourseMapper")
    private SelectcourseMapper selectcourseMapper;
    @Override
    public List<Selectcourse> listAllSelectCourse() {
        return selectcourseMapper.selectByExample(new SelectcourseExample()) ;
    }

    @Override
    public Integer createSelectCourse(Selectcourse selectCourse) {
        return selectcourseMapper.insert(selectCourse);
    }

    @Override
    public Integer update(Selectcourse selectCourse) {
        return selectcourseMapper.updateByPrimaryKey(selectCourse);
    }

    @Override
    public Integer deleteSelectCourse(int id,int seid) {
        return selectcourseMapper.deleteByPrimaryKey(seid,id);
    }

    @Override
    public Selectcourse getSelectCourse(int id,int seid) {
        return selectcourseMapper.selectByPrimaryKey(seid,id);
    }

    public List<Selectcourse> SelectCoursebyStudentid(Integer studentid){
        SelectcourseExample selectcourseExample=new SelectcourseExample();
        selectcourseExample.or().andIdEqualTo(studentid);

        return  selectcourseMapper.selectByExample(selectcourseExample) ;
    }

}
